$(function() {
    var a = function() {
        var b = $("#divOrderLoading");
        var h = $("#btnLoadMore");
        var f = 0;
        var i = 10;
        var c = {
            FIdx: 0,
            EIdx: i,
            isCount: 1
        };
        var g = null;
        var e = false;
        var d = function() {
            var j = function() {
                return "&fx=" + c.FIdx + "&ex=" + c.EIdx + "&ic=" + c.isCount
            };
            var k = function() {
                h.hide();
                b.show();
			    GetJPData(Gobal.Webpath, "User", "mygoods"+j(),
                function(p) {				 
                    if (p.code == 0) {
                        if (c.isCount == 1) {
                            c.isCount = 0;
                            f = p.count
                        }
                        var o = p.listItems;
                        var n = o.length;
                        var m = "";
						
                        for (var l = 0; l < n; l++) {						 
							m += "<li onclick=\"location.href='"+Gobal.Webpath+"/index.php?m=Go&c=Index&a=item&gid=" + o[l].shopid +'\'"><a class="fl z-Limg" href="'+Gobal.Webpath+'/index.php?m=Go&c=Index&a=item&gid=' + o[l].shopid +'"><img src="' + Gobal.LoadPic + '" src2="'+Gobal.Webpath+'/' + o[l].thumb + '" border=0 alt=""/></a><div class="u-gds-r gray9"><p class="z-gds-tt"><a href="'+Gobal.Webpath+'/index.php?m=Go&c=Index&a=item&gid=' + o[l].shopid +'" class="gray6">(第' + o[l].qishu + "期)" + o[l].shopname + '</a></p><p>幸运抢购码：<em class="orange">' + o[l].q_user_code + "</em></p><p>揭晓时间：" + o[l].q_end_time + "</p>";
                            m += "<p>订单状态："+o[l].status+"</p>";
							var q = parseInt(o[l].orderState);
                            m += '</div><b class="z-arrow"></b></li>'
                        }
                        if (c.FIdx > 0) {
                            b.prev().removeClass("bornone")
                        }
                        b.before(m).prev().addClass("bornone");						
                        if (c.EIdx < f) {
                            e = false;
                            h.show()
                        }
                        loadImgFun()
                    } else {
                        if (p.code == 10) {
                            location.reload()
                        } else {
                            if (c.FIdx == 0) {
                                b.before(Gobal.NoneHtml)
                            }
                        }
                    }
                    b.hide()
                })
            };
            this.getInitPage = function() {
                k()
            };
            this.getNextPage = function() {
                c.FIdx += i;
                c.EIdx += i;
                k()
            }
        };
        h.click(function() {
            if (!e) {
                e = true;
                g.getNextPage()
            }
        }).show();
        g = new d();
        g.getInitPage()
    };
    Base.getScript(Gobal.Skin + "/js/Comm.js", a)
});